function [output subjectinfo] = plotTfcPeaks (subjectinfo, cfg)
if nargin==1 || isempty(cfg)
    cfg = plotTfcPeaks_defaultCfg();
end
ensurePath([getpref('ECoG','Results') 'TFC\']);
tStart = tic;
output = [];

fnES = fieldnames(subjectinfo.EpochData);
for i = 1:length(fnES)
    currentEpochset = fnES{i};
%     disp (['Plotting peak chart for ''' subject.DS.EpochData.(currentEpochset).name '''']);

    %% Load the data
    load(subjectinfo.EpochData.(currentEpochset).TfcDatafile);
    [datatable header] = TfcToDatatable(tfc);

    channelregions = {subjectinfo.Electrodes.Label;subjectinfo.Electrodes.Region}';
    elecsel = find([subjectinfo.Electrodes.SelectedManually]);
    cfg.ElectrodeSelection = unique({subjectinfo.Electrodes(elecsel).Label});

    plotTfcPeaks_Core(datatable, header, subjectinfo.Name, ...
        subjectinfo.EpochData.(currentEpochset).name, cfg);

    disp('Saving figures...')
    saveFigure(fig, [getpref('ECoG','Results') 'TFC\Significant Peaks\SelectionOfElectrodes\'], [subjectinfo.PrimaryPrefix ' ' EpochDatasetName ' - SignificantPeaksByRegionPerBin - Two-sided - Selection of Electrodes']);
    close(fig);
end
output.TimePassed = toc(tStart);
end